package com.creating.mict.action;



import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.creating.mict.domain.LisRecord;
import com.creating.mict.domain.Patient;
import com.creating.mict.domain.XyjRecord;
import com.creating.mict.service.ILisService;
import com.creating.mict.service.IXyjService;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 
* @ClassName: XyjAction 
* @Description: 血压计模块ACtion
* @author xuelei
* @date Dec 27, 2012 10:28:55 AM 
*
 */
@SuppressWarnings("serial")
public class LisAction extends ActionSupport {

	@Resource
	private ILisService lisService;
	
	/**
	 * 
	* @Title: queryXyjRecord 
	* @Description: 获取LIS检查结果
	* @param @return 
	* @return String    返回类型 
	* @throws
	 */
	public String queryLisResult() {
		HttpServletRequest request = ServletActionContext.getRequest();
		//或当前登录用户名
		String loginName = (String)request.getSession().getAttribute("loginName");
		List<LisRecord> list = lisService.queryLisResult(fbtime, fetime, fkeywords); //全部查询，包括隐藏信息
		
		if (list == null) {
			total = 0;
		} else {
			total = list.size();
		}
		
		StringBuffer jsonStr = new StringBuffer("[");
		if (start + limit > total)
			limit = total - start;
		for (int i = start; i < start + limit; i++)
		{
			LisRecord lr = new LisRecord();
			lr = list.get(i);
			jsonStr.append("{");
			jsonStr.append("fname:'").append(lr.getFname()).append("',");
			jsonStr.append("fvalue:'").append(lr.getFvalue()).append("',");
			jsonStr.append("fdesc:'").append(lr.getFdesc()).append("',");
			jsonStr.append("fphone:'").append(lr.getFphone()).append("',");
			jsonStr.append("fdoc:'").append(lr.getFdoc()).append("',");
			jsonStr.append("freference:'").append(lr.getFreference()).append("',");
			jsonStr.append("fdate:'").append(lr.getFdateStr()).append("'");
			
			if (i == (start + limit) - 1)
				jsonStr.append("}");
			else
				jsonStr.append("},");
		}
		jsonStr.append("]");
		String str = "{totalProperty: " + list.size() + ", root:" + jsonStr + "}";
		request.setAttribute("result", str);
		return "success";
	}
	
	
	
	
	private int limit = 50; //分页结束
	private int start = 0;  //分页起始
	private int total;		//总页数
	
	private String query;
	private String fbtime;
	private String fetime;
	private String fstate;
	private String fkeywords;
	private String fvalueType;
	private String fvalue1;
	private String fvalue2;
	private String ftakeBack;
	
	
	private String fpid;
	private String fname;
	private String fname_pym;
	private String fsex;
	private String fidcd;
	private String fadd_jd;
	private String fadd_jd_pym;
	private String fadd_detail;
	private String fpcs;
	private String fjwh;
	private String fjwh_pym;
	private String fphone1;
	private String fphone2;
	private String fsign_doctor;
	private String fsign_type;
	private Date fsign_date;
	private String fsign_state;
	private String fybkh;


	public String getFybkh() {
		return fybkh;
	}

	public void setFybkh(String fybkh) {
		this.fybkh = fybkh;
	}

	public String getFpid() {
		return fpid;
	}


	public void setFpid(String fpid) {
		this.fpid = fpid;
	}


	public String getFname_pym() {
		return fname_pym;
	}


	public void setFname_pym(String fname_pym) {
		this.fname_pym = fname_pym;
	}


	public String getFsex() {
		return fsex;
	}


	public void setFsex(String fsex) {
		this.fsex = fsex;
	}


	public String getFidcd() {
		return fidcd;
	}


	public void setFidcd(String fidcd) {
		this.fidcd = fidcd;
	}


	public String getFadd_jd() {
		return fadd_jd;
	}


	public void setFadd_jd(String fadd_jd) {
		this.fadd_jd = fadd_jd;
	}


	public String getFadd_jd_pym() {
		return fadd_jd_pym;
	}


	public void setFadd_jd_pym(String fadd_jd_pym) {
		this.fadd_jd_pym = fadd_jd_pym;
	}


	public String getFadd_detail() {
		return fadd_detail;
	}


	public void setFadd_detail(String fadd_detail) {
		this.fadd_detail = fadd_detail;
	}


	public String getFpcs() {
		return fpcs;
	}


	public void setFpcs(String fpcs) {
		this.fpcs = fpcs;
	}


	public String getFjwh() {
		return fjwh;
	}


	public void setFjwh(String fjwh) {
		this.fjwh = fjwh;
	}


	public String getFjwh_pym() {
		return fjwh_pym;
	}


	public void setFjwh_pym(String fjwh_pym) {
		this.fjwh_pym = fjwh_pym;
	}


	public String getFphone1() {
		return fphone1;
	}


	public void setFphone1(String fphone1) {
		this.fphone1 = fphone1;
	}


	public String getFphone2() {
		return fphone2;
	}


	public void setFphone2(String fphone2) {
		this.fphone2 = fphone2;
	}


	public String getFsign_doctor() {
		return fsign_doctor;
	}


	public void setFsign_doctor(String fsign_doctor) {
		this.fsign_doctor = fsign_doctor;
	}


	public String getFsign_type() {
		return fsign_type;
	}


	public void setFsign_type(String fsign_type) {
		this.fsign_type = fsign_type;
	}


	public Date getFsign_date() {
		return fsign_date;
	}


	public void setFsign_date(Date fsign_date) {
		this.fsign_date = fsign_date;
	}


	public String getFsign_state() {
		return fsign_state;
	}


	public void setFsign_state(String fsign_state) {
		this.fsign_state = fsign_state;
	}


	public int getLimit() {
		return limit;
	}


	public void setLimit(int limit) {
		this.limit = limit;
	}


	public int getStart() {
		return start;
	}


	public void setStart(int start) {
		this.start = start;
	}


	public int getTotal() {
		return total;
	}


	public void setTotal(int total) {
		this.total = total;
	}


	public String getFbtime() {
		return fbtime;
	}


	public void setFbtime(String fbtime) {
		this.fbtime = fbtime;
	}


	public String getFetime() {
		return fetime;
	}


	public void setFetime(String fetime) {
		this.fetime = fetime;
	}


	public String getFstate() {
		return fstate;
	}


	public void setFstate(String fstate) {
		this.fstate = fstate;
	}


	public String getFkeywords() {
		return fkeywords;
	}


	public void setFkeywords(String fkeywords) {
		this.fkeywords = fkeywords;
	}


	public String getFname() {
		return fname;
	}


	public void setFname(String fname) {
		this.fname = fname;
	}

	public String getFvalueType() {
		return fvalueType;
	}

	public void setFvalueType(String fvalueType) {
		this.fvalueType = fvalueType;
	}

	public String getFvalue1() {
		return fvalue1;
	}

	public void setFvalue1(String fvalue1) {
		this.fvalue1 = fvalue1;
	}

	public String getFvalue2() {
		return fvalue2;
	}

	public void setFvalue2(String fvalue2) {
		this.fvalue2 = fvalue2;
	}

	public String getFtakeBack() {
		return ftakeBack;
	}

	public void setFtakeBack(String ftakeBack) {
		this.ftakeBack = ftakeBack;
	}

	public String getQuery() {
		return query;
	}

	public void setQuery(String query) {
		this.query = query;
	}


	
	
}
